package com.example.security.web;

import com.example.security.domain.Menu;
import com.example.security.service.MenuService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@RequiredArgsConstructor
@RestController
@RequestMapping("menu")
public class MenuController {


    private final MenuService menuService;


    @GetMapping()
    public PageInfo<Menu> list(@RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "10") int pageSize, Menu menuBo) {
        PageHelper.startPage(pageNum, pageSize);
        List<Menu> menuVoList = menuService.queryMenuList(menuBo);
        return new PageInfo<>(menuVoList);
    }


    @PostMapping()
    public String add(@RequestBody Menu menu) {

        return "add success!";
    }


    @PutMapping()
    public String edit() {

        return "admin edit success!";
    }

    @DeleteMapping()
    public String remove() {
        return "delete success!";
    }


}
